<div id="cat-config" style="display:none;"></div>

<div id="BrandList" class="tableform widgetconfig">
<div class="division" >
<table>
    <tr>
      <th><{t app='b2c'}>显示品牌数：<{/t}></th>
      <td><{input name="num" value=$setting.num|default:10 size="8" required="true" type="digits"}></td>
    </tr>
    <tr>
      <th><{t app='b2c'}>显示：<{/t}></th>
        <td>
          <select name="brandSet">
              <option value="logo" <{if $setting.brandSet=='logo'}> selected="selected"<{/if}>><{t app='b2c'}>Logo图片<{/t}></option>
              <option value="write" <{if $setting.brandSet=='write'}> selected="selected"<{/if}>><{t app='b2c'}>文字描述<{/t}></option>
              <option value="all" <{if $setting.brandSet=='all'}> selected="selected"<{/if}>><{t app='b2c'}>Logo图片和文字<{/t}></option>
          </select>
        </td>
    </tr>
</table>
</div>

<div class="division" id="show_brand">
<table>
    
    <tr>
      <th><{t app='b2c'}>显示列数：<{/t}></th>
      <td><{input name="col" value=$setting.col|default:2 size="8"  required="true" type="digits"}></td>
    </tr>
	
</table>
</div>
<div class="division" id="new_show_brand">
<table>
    <tr>
      <th><{t app='b2c'}>LOGO图片大小：<{/t}></th>
      <td><{t app='b2c'}>长：<{/t}><{input name="brandLogoWidth" value=$setting.brandLogoWidth|default:88 size="3" required="true" type="digits"}>px&nbsp;<{t app='b2c'}>高：<{/t}><{input name="brandLogoHeight" value=$setting.brandLogoHeight|default:31 size="3" required="true" type="digits"}>px</td>
    </tr>
    <tr>
      <th><{t app='b2c'}>每条记录左右间距：<{/t}></th>
      <td><{input name="brandLogoHSep" value=$setting.brandLogoHSep|default:10 size="3" required="true" type="digits"}>px</td>
    </tr>
    <tr>
      <th><{t app='b2c'}>每条记录上下间距：<{/t}></th>
      <td><{input name="brandLogoVSep" value=$setting.brandLogoVSep|default:15 size="3" required="true" type="digits"}>px</td>
    </tr>
    <tr>
      <th><{t app='b2c'}>Logo与文字的间距：<{/t}></th>
      <td><{input name="brandLogoFontSep" value=$setting.brandLogoFontSep|default:5 size="3" required="true" type="digits"}>px</td>
    </tr>
    <tr>
      <th><{t app='b2c'}>是否显示更多：<{/t}></th>
        <td><input type="radio" name="showMore" value="on" <{if $setting.showMore != 'off'}>checked="checked"<{/if}> ><{t app='b2c'}>是<{/t}> <input type="radio" name="showMore" value="off" /><{t app='b2c'}>否<{/t}></td>
    </tr>
</table>
</div>
</div>

<script>
function getCfgForm(id){
  var config = $(id);
  while(config.tagName != 'FORM'){
    config = config.getParent();
  }
  return config;
}

function getWgtTpl(){
  var sels = getCfgForm('cat-config').getElements('select');
  var wgtTpl = '';
  sels.each(function(sel){
    if(sel.getProperty('name') == '__wg[tpl]') wgtTpl = sel;
  });
  return wgtTpl;
}
function setCfgView(view){
  switch(view){
    case 'default.html':
    $('show_brand').style.display="";
    $('new_show_brand').style.display="none";
    break;
    case 'newBrandList.html':
    $('show_brand').style.display="none";
    $('new_show_brand').style.display="";
    break;
  }
}
var catTpl = getWgtTpl();
catTpl.addEvent('change',function(){
  setCfgView(this.value);
});
setCfgView(catTpl.value);
</script>